The CODESYS OPC UA Server provides the capability of sending standard OPC UA events and mapping alarms in a simplified form.




CAUTION

The mapping of alarms from the alarm management does not meet all requirements from the OPC UA specification. In particular, the state machines are different and no comments can be assigned. The mapping is used to provide the possibility of basic interaction between an OPC UA Client and the alarm management.
Creating alarms and events
-
Create a new project with a CODESYS Control Win V3 controller.
-
Insert an “Alarm configuration” object below the application.
-
Add the library
CmpOPCUAProviderAlarmConfiguration
to the Library Manager.When the library is added, it connects automatically as a client to the alarm configuration and sends the events to the OPC UA Server.
-
Insert a “Symbol Configuration” object below the application.
-
Insert a “Visualization” object below the “Application”.
-
Download the project to the controller and start it.
Alarms are used and generated normally. No special steps are required here.
If you want to create events, then the following additional steps are required.
-
Insert an “AlarmClass” object below the “Alarm Configuration”. Specify a name (example:
Event
).The new alarm class opens in the editor.
-
Select the acknowledgment method “REP”.
-
Insert an “Alarm Group” object below the “Alarm Configuration”. Specify a name (example:
ApplicationEvent
).The new alarm group opens in the editor.
-
Change the following parameters:
-
“Observation type”: “Event”
-
“Class”: “Event”
-
“Message”: "Message 1"
-
-
In the Program (for example, POU
PLC_PRG
), add a program call for triggering the event alarm.AlarmManager.AlarmGlobals.g_AlarmHandler.RaiseEvent(Alm_AlarmConfiguration_Alarmgroup_IDs.ID_ApplicationEvent, Alm_ApplicationEvent_Alarm_IDs.ID_0);
For more information about alarm management and alarm visualization, see: ⮫ Alarm Management and ⮫ Alarm Visualization